cmake_minimum_required(VERSION 3.19)
project(vulkan_lib)

if (MSVC)
    add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
    add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
#set(CMAKE_C_STANDARD 11)
#set(CMAKE_C_STANDARD_REQUIRED ON)
#set(CMAKE_C_EXTENSIONS OFF)

set(local_path ${CMAKE_CURRENT_SOURCE_DIR})
set(lib_path ${local_path}/../../libs)
set(include_path ${local_path}/../../include)

file(GLOB_RECURSE vulkan_code LIST_DIRECTORIES false
        ${local_path}/*.hpp ${local_path}/*.h
        ${local_path}/*.cpp ${local_path}/*.c
        )
add_library(vulkan_lib STATIC ${vulkan_code})
target_link_libraries(vulkan_lib PUBLIC ${lib_path}/vulkan-1.lib ${lib_path}/glfw3.lib)
target_include_directories(vulkan_lib PUBLIC ${include_path})

target_compile_definitions(vulkan_lib PUBLIC CURRENT_WORKING_DIR="${CMAKE_CURRENT_SOURCE_DIR}/..")

#-----------------------------------glslang-------------------------------------------------
set(glslang_path ${local_path}/../../3rdparty/glslang)

option(ENABLE_SPVREMAPPER OFF)
option(ENABLE_GLSLANG_BINARIES OFF)
option(ENABLE_HLSL OFF)
option(ENABLE_OPT OFF)
option(BUILD_TESTING OFF)
option(BUILD_EXTERNAL OFF)
add_subdirectory(${glslang_path} ${CMAKE_BINARY_DIR}/glslang)

target_link_libraries(vulkan_lib PUBLIC SPIRV)
#-------------------------------end glslang----------------------------------------
